package util;

import cas.GPSSimulator;
import gov.nasa.worldwind.geom.LatLon;

public class Converter {
	public static double meterToRadian(double meter, LatLon curCoord){
		return meter/getGlobeRadius(curCoord);
	}
	public static double radianToMeter(double radian, LatLon curCoord){
		return radian*getGlobeRadius(curCoord);
	}
	public static double meterToDegrees(double meter, LatLon curCoord){
		return Math.toDegrees(meterToRadian(meter, curCoord));
	}
	public static double degreesToMeter(double degrees, LatLon curCoord){
		return radianToMeter(Math.toRadians(degrees), curCoord);
	}
	public static double getGlobeRadius(LatLon curCoord){
		return GPSSimulator.getGlobe().getRadiusAt(curCoord);
	}
}
